#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: solution.py 
@version:
@time: 2024/01/22 
"""
import pdb

while True:
    try:
        # n数量，m数字
        n, m = map(int, input().split())
        ints = list(map(int, input().split()))

        pre_sum = 0
        is_true = False
        remainders = set()
        # 2 12 6 3 5 5
        for i in range(n):
            # 每次保留pre_sum,表示有除不尽的数
            # 0  pre_sum = 0
            # 2 ->除不尽  pre_sum = 2    remainders = {2}
            # 12 -> 2+12 pre_sum = 0   remainders = {0, 2}
            # 6 ->除不尽  pre_sum = 6 remainders = {0, 2, 6}
            # 3 ->除不尽  pre_sum = 9%7= 2 remainders =  {0, 2, 6}
            # 5 ->除不尽  pre_sum = 2+5%7=0
            pre_sum = (pre_sum + ints[i]) % m
            if pre_sum in remainders:
                is_true = True
                break
            remainders.add(pre_sum)
            print(remainders)

        print(1 if is_true else 0)

    except EOFError:
        break
